package com.zhaowb.springcloud.admin.rpc;

import com.zhaowb.springcloud.admin.biz.GateLogBiz;
import com.zhaowb.springcloud.admin.entity.GateLog;
import com.zhaowb.springcloud.api.vo.log.LogInfo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IDEA
 *
 * @author zhaowb
 * @date 2018/11/7 21:13
 */
@Controller
@RequestMapping("api")
public class LogService {

    @Autowired
    private GateLogBiz gateLogBiz;

    @ResponseBody
    @RequestMapping(value = "/log/save", method = RequestMethod.POST)
    public void saveLog(@RequestBody LogInfo logInfo) {
        GateLog gateLog = new GateLog();
        BeanUtils.copyProperties(logInfo, gateLog);
        gateLogBiz.insertSelective(gateLog);
    }
}
